﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace YamrSyncDemo.YammerWrapper
{
    public class YammerConnectionConfig
    {
        public string ClientID { get; set; }
        public string ClientSecret { get; set; }
        public string UserName { get; set; }
        public string Password { get; set; }
        // e.g. "contoso.com"
        public string CorpDomain { get; set; }
        
        private const string RedirectUrl = "https://localhost";

        public string PermUrl
        {
            get { return "https://www.yammer.com/dialog/oauth?client_id=" + ClientID + "&redirect_uri=" + RedirectUrl; }
        }

        public string AuthUrl1
        {
            get { return "https://www.yammer.com/session?client_id=" + ClientID; }
        }

        public string AuthUrl2
        {
            get { return "https://www.yammer.com/" + CorpDomain + "/oauth2/decision" + "?client_id=" + ClientID + "&redirect_uri=" + HttpUtility.UrlEncode(RedirectUrl) + "&response_type=code"; }
        }

        public string AccTokenUrl
        {
            get { return "https://www.yammer.com/oauth2/access_token.json?client_id=" + ClientID + "&client_secret=" + ClientSecret + "&code="; }
        }

        //string authUrl2 = "https://www.yammer.com/contoso.com/oauth2/" + CLIENT_ID +
        //    "/authorize?client_id=" + CLIENT_ID + "&display=page&redirect_uri=" + HttpUtility.UrlEncode(REDIR_URL) + 
        //    "&response_type=code";

    }
}
